<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.67">
    <title>反洗钱预警管控平台——主菜单</title>
    <link rel="stylesheet" href="../iconfont/iconfont.css">
    <style>
        html {
            background: linear-gradient(to right, rgb(118, 118, 173), rgb(40, 126, 119));
            cursor: default;
        }


        ::-webkit-scrollbar {
            /* display: none; */
        }

        #sidebar {
            overflow-y: scroll;
            /* overflow-wrap: break-word; */
            width: 220px;
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, .7);
            box-shadow: 5px 0px 5px rgba(0, 0, 0, .4);
            z-index: 10;
        }

        #sidebar {
            margin: 0 0 0 0;
            padding: 0;
            font-family: "iconfont" !important;
            list-style: none;
            font-size: 22px;
            color: #fff;
        }

        #sidebar::-webkit-scrollbar{
            display: none;
        }

        #sidebar>li {
            padding-left: 20%;
            height: 100px;
            display: flex;
            align-items: center;
        }

        #sidebar>li>p {
            vertical-align: middle;
        }

        #sidebar>li:hover {
            background-color: rgba(255, 255, 255, 0.1);
        }

        .news-board>p::before {
            content: '\e6d3';
            margin-right: 10px;
        }

        .my-info>p::before {
            content: '\ebcc';
            margin-right: 10px;
        }

        .user-manage>p::before {
            content: '\e650';
            margin-right: 10px;
        }

        .trade-check>p::before {
            content: '\e69e';
            margin-right: 10px;
        }

        .trade-manage>p::before {
            content: '\e695';
            margin-right: 10px;
        }

        .settings>p::before {
            content: '\e62a';
            margin-right: 10px;
        }

        #content {
            display: block;
            margin-left: 230px;
            margin-right: 22px;
            padding: 0;
            list-style: none;
            font-size: 24px;
            background-color: transparent;
        }

        .all-news-board {
            margin: 0 0 25px 0;
            font-size: 24px;
            height: 75vh;
            padding: 0 0 0 0;
            border-radius: 15px;
            background-color: transparent;
            white-space: nowrap;
            overflow-x: scroll;
            overflow-y: hidden;
            list-style: none;
            display: block;
        }

        .all-news-board::-webkit-scrollbar {
            height: 16px;
        }

        .all-news-board::-webkit-scrollbar-thumb {
            border-radius: 16px;
            background: rgba(0, 0, 0, 0.35); 
            -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2); 
        }
        .all-news-board::-webkit-scrollbar-thumb:window-inactive {
            background: rgba(0, 0, 0, 0.4); 
        }

        .all-news-board li {
            display: inline-block;
            vertical-align: top;
            min-height: 70vh;
            height: 94%;
            width: 32%;
            margin: 1.2% 0 1.2% 0;
            border-radius: 15px;
            background-color: rgba(0, 0, 0, 0.5);
            overflow: hidden;
            color: #e1e1e1;
            transition: all 0.3s;
            position: relative;
        }

        .news p {
            /* margin: 0px 30px; */
            margin-left: 25px;
            margin-right: 25px;
            font-family: 华文仿宋;
            font-size: 20px;
            white-space: pre-wrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
        }

        .news>.news-origin {
            font-style: italic;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            margin-bottom: 30px;
            font-size: 32px;
            text-align: left;
        }

        .news>.news-title {
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            font-size: 37px;
            font-weight: bold;
            text-align: center;
        }

        .news>.news-time {
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            font-size: 24px;
            font-weight: bold;
            text-align: center;
        }

        .news>.news-content {
            font-size: 28px;
            -webkit-line-clamp: 5;
            -webkit-box-orient: vertical;
        }

        .tips-show {
            margin-bottom: 20px;
            border-radius: 15px;
            background-color: rgba(255, 255, 255, 0.12);
            color: #fff;
            font-family: 隶书;
            font-size: 60px;
            text-align: center;
        }

        .news:hover {
            width: 50%;
        }

        .no-line-limit {
            -webkit-line-clamp: 1000 !important;
        }

        .zoom-in, .zoom-out{
            display: none;
            position: absolute;
            bottom: 0;
            margin: 10px 0 0 0;
            width: 100%;
            color: black;
            text-align: center;
            font-size: 30px;
            background-color: rgba(255,255,255, 0.7);
        }

        .zoom-in:hover, .zoom-out:hover{
            cursor: pointer;
            background-color: rgba(81, 154, 255, 0.9);
        }
        .zoom-in::after{
            content: '\e87e';
            font-family: 'iconfont';
        }
        .zoom-out::after{
            content: '\e892';
            font-family: 'iconfont';
            font-size: 30px;
            color: black;
        }

        .write-news-board {
            margin: 0 0 25px 0;
            font-size: 24px;
            height: 75vh;
            padding: 0 0 0 0;
            border-radius: 15px;
            background-color: rgba(255,255,255, 0.35);
            display: block;
        }

    </style>
</head>

<body>
    <ul id="sidebar">
        <li class="news-board">
            <p>公告栏</p>
        </li>
        <li class="my-info">
            <p>我的信息</p>
        </li>
        <li class="user-manage">
            <p>用户管理</p>
        </li>
        <li class="trade-check">
            <p>交易审查</p>
        </li>
        <li class="trade-manage">
            <p>交易管理</p>
        </li>
        <li class="settings">
            <p>设置</p>
        </li>
    </ul>
    <ul id="content">
        <li class="news-board-content">
            <div class="tips-show">
                公告栏
            </div>
            <ul class="all-news-board">
                <li class="news">
                    <p class="news-origin">光圈科技有限公司哈哈哈哈哈哈哈哈哈</p>
                    <p class="news-title">测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点测试内容随便写点
                    </p>
                    <p class="news-time">2023-02-06 01:27:35</p>
                    <p class="news-content">这只是个测试罢了哈哈哈哈
哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊
哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈啊哈哈这只是个测试罢了哈哈哈哈
哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊
哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈啊哈哈这只是个测试罢了哈哈哈哈
哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊
哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈啊哈哈这只是个测试罢了哈哈哈哈
哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊
哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈啊哈哈这只是个测试罢了哈哈哈哈
哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊
哈哈哈哈哈哈哈哈啊哈哈哈哈哈哈哈哈啊哈哈啊哈哈
                    </p>
                </li>
                <li class="news">
                    <p class="news-origin">西南科技大学ACM团队</p>
                    <p class="news-title">有关第22届ACM积分赛规则的更改</p>
                    <p class="news-time">2023-02-06 01:27:35</p>
                    <p class="news-content">
所有IT机构课程免费下载，群内每人都可开通权限，网盘发放资源，一起350T，刚出来的，99%的人都不知道的渠道。想提高技术的看过来java、golang、python、php、rust、前端、vue、大数据、人工智能、机器学习、算法、C++、docker、k8s、运维测试、云原生等各大技术课程。高清无密，课件齐全，永久更新
【进群请我v，信，:2256598】
                    </p>
                </li>
                <li class="news">
                    <p class="news-origin">佚名</p>
                    <p class="news-title">柘失吴夏雪地</p>
                    <p class="news-time">2023-02-06 01:27:35</p>
                    <p class="news-content">[居中]
人间四月芳菲尽
三月桃花二月开
花花世界迷人眼
浅草才能没马蹄
马失前蹄
焉知非福
                    </p>
                </li>
                <li class="news">
                    <p class="news-origin">ChatGPT</p>
                    <p class="news-title">剑客行</p>
                    <p class="news-time">2023-02-06 01:27:35</p>
                    <p class="news-content">[居中]
能以风雪纵横行
不惧千山万水难
跋涉酒庄黑夜间
一袭白衣如冰寒
征途长，剑气张
无惧弱敌险阻阵
夜幕降，星河灿
空留壮志与英雄
            </p>
            </ul>

            <div class="tips-show">
                撰写公告
            </div>
            <div class="write-news-board">

            </div>
        </li>

        <li class="my-info-content">
            <div class="tips-show">我的信息</div>
        </li>

        <li class="user-manage-content">
        </li>

        <li class="trade-check-content">
        </li>

        <li class="trade-manage-content">
        </li>

        <li class="settings-content">
        </li>
    </ul>

</body>
<script>

    const sidebar = document.querySelector("#sidebar").children;
    const content = document.querySelector("#content").children;
    const all_news_board = document.querySelector(".all-news-board");
    let viewportWidth = window.innerWidth;
    let news_width_delete = 252;

    for (var i = 0; i < sidebar.length; i++) {
        sidebar[i].setAttribute('index', i);
        content[i].style.display = 'none';
        sidebar[i].onclick = function () {
            var index = this.getAttribute('index');
            for (var i = 0; i < content.length; i++) {
                content[i].style.display = 'none';
            }
            content[index].style.display = 'block';
        }
    }
    content[0].style.display = 'block';

    const news_list = all_news_board.children;
    for(var i = 0; i<news_list.length; i++){
        news_list[i].setAttribute('state', 'zoom-out');

        const element = document.createElement('div');
        const element2 = document.createElement('div');
        element.classList.add('zoom-in');
        element2.classList.add('zoom-out');
        element.setAttribute('index', i);
        element2.setAttribute('index', i);
        news_list[i].appendChild(element);
        news_list[i].appendChild(element2);
        
        var textList = news_list[i].querySelectorAll('p');
        
        var finalWidth = (viewportWidth - news_width_delete) * 0.28;
        for(var j = 0; j<textList.length; j++){
            textList[j].style.width = finalWidth + "px";
        }

        news_list[i].addEventListener('mouseover', function(event){
            var state = this.getAttribute('state');
            var button1 = this.querySelector('.zoom-in');
            var button2 = this.querySelector('.zoom-out');
            if(state=='zoom-out'){
                button1.style.display = 'inline';
                button2.style.display = 'none';
            }else{
                button2.style.display = 'inline';
                button1.style.display = 'none';
            }
            if(state == 'zoom-out'){
                var textList = this.querySelectorAll('p');
                
                var finalWidth = (viewportWidth - news_width_delete) * 0.458;
                for(var j = 0; j<textList.length; j++){
                    textList[j].style.width = finalWidth + "px";
                }
            }
            
        });
        news_list[i].addEventListener('mouseout', function(event){
            var state = this.getAttribute('state');
            var button1 = this.querySelector('.zoom-in');
            var button2 = this.querySelector('.zoom-out');
            button1.style.display = 'none';
            button2.style.display = 'none';

            if(state == 'zoom-out'){
                var textList = this.querySelectorAll('p');
                var finalWidth = (viewportWidth - news_width_delete) * 0.28;
                for(var j = 0; j<textList.length; j++){
                    textList[j].style.width = finalWidth + "px";
                }
            }
        });

        
        var button1 = news_list[i].querySelector('.zoom-in');
        var button2 = news_list[i].querySelector('.zoom-out');
        button1.setAttribute('index', i);
        button2.setAttribute('index', i);
        button1.addEventListener('click', function(event){
            var index = this.getAttribute('index');
            all_news_board.setAttribute('offset', all_news_board.scrollLeft);
            news_list[index].style.width = '100%';
            news_list[index].setAttribute('state', 'zoom-in');
            for(var i = 0; i<news_list.length; i++){
                news_list[i].style.display = 'none';
            }
            news_list[index].style.display = 'inline-block';
            news_list[index].style.height = 'auto';
            news_list[index].style['min-height'] = '90vh';
            all_news_board.style.height = 'auto';
            var textList = news_list[index].children;
            for(var i = 0; i<4;i++){
                textList[i].style['-webkit-line-clamp'] = '1000';
            }
            window.scrollTo(0, 100);

            var textList = news_list[index].querySelectorAll('p');
            var finalWidth = (viewportWidth - news_width_delete) * 0.95;
            for(var i = 0; i<textList.length; i++){
                textList[i].style.width = finalWidth + "px";
            }
        });
        button2.addEventListener('click', function(event){
            var index = this.getAttribute('index');
            news_list[index].style.width = '';
            news_list[index].setAttribute('state', 'zoom-out');
            for(var i = 0; i<news_list.length; i++){
                news_list[i].style.display = 'inline-block';
            }
            news_list[index].style.height = '';
            news_list[index].style['min-height'] = '';
            all_news_board.style.height = '75vh';
            var textList = news_list[index].children;
            var valList = [1, 2, 1, 5];
            for(var i = 0; i<4;i++){
                textList[i].style['-webkit-line-clamp'] = valList[i];
            }
            window.scrollTo(0, 0);
            all_news_board.scrollLeft = all_news_board.getAttribute('offset');

            var textList = news_list[index].querySelectorAll('p');
            var finalWidth = (viewportWidth - news_width_delete) * 0.28;
            for(var i = 0; i<textList.length; i++){
                textList[i].style.width = finalWidth + "px";
            }
        });
    }

    //当文本以[居中]开头时, 文本会被居中显示
    var contentList = document.querySelectorAll('.news-content');
    for (var i = 0; i < contentList.length; i++) {
        var this_content = contentList[i].textContent;
        contentList[i].textContent += '\n';
        if (this_content.startsWith('[居中]')) {
            contentList[i].style.textAlign = 'center';
            contentList[i].textContent = this_content.replace('[居中]', '');
        }
    }

    window.addEventListener('resize', function(){
        viewportWidth = window.innerWidth;

        for(var i = 0; i<news_list.length; i++){
            var state = news_list[i].getAttribute('state');
            var textList = news_list[i].querySelectorAll('p');
            if(state == 'zoom-in'){
                var finalWidth = (viewportWidth - news_width_delete) * 0.95;
            }else{
                var finalWidth = (viewportWidth - news_width_delete) * 0.28;
            }
            for(var j = 0; j<textList.length; j++){
                textList[j].style.width = finalWidth + "px";
            }
        }
    });


</script>

</html>